package top.usts.springframework.core.convert;

import com.sun.istack.internal.Nullable;

/**
 * @description:
 *
 * 类型转换抽象接口
 * @author: CJ
 * @date: 2022/2/27
 */
public interface ConversionService {

    /**Return {@code true} if objects of {@code sourceType} can be converted to the {@code targetType}. ***/
    boolean canConvert(@Nullable Class<?> sourceType, Class<?> targetType);

    /**Convert the given {@code source} to the specified {@code targetType}.**/
    <T> T convert(Object source, Class<T> targetType);


}
